From: Álvaro Fernández Rojas Date: Thu, 13 Nov 2025 10:46:51 +0000 (+0100) Subject: odhcp6c: properly guard attributes X-Git-Url: http://git.openwrt.org/%22https:/collectd.org//%22http:/www.crowdsec.net/%22/%22https:/collectd.org/%22http:/www.crowdsec.net/%22?a=commitdiff_plain;h=b46d79c8792cd5de9aded0c83956cd5ac76f8697;p=project%2Fodhcp6c.git odhcp6c: properly guard attributes Properly guard odhcp6c.h attributes with `#ifndef` to avoid redefining them when including external headers. Also convert the remaining __attribute__ usages to the custom declarations. Signed-off-by: Álvaro Fernández Rojas Link: https://github.com/openwrt/odhcp6c/pull/120 --- diff --git a/src/odhcp6c.h b/src/odhcp6c.h index 6c669c0..02578cc 100644 --- a/src/odhcp6c.h +++ b/src/odhcp6c.h @@ -20,9 +20,17 @@ #include #include -#define _o_unused __attribute__((unused)) -#define _o_packed __attribute__((packed)) +#ifndef _o_aligned #define _o_aligned(n) __attribute__((aligned(n))) +#endif /* _o_aligned */ + +#ifndef _o_packed +#define _o_packed __attribute__((packed)) +#endif /* _o_packed */ + +#ifndef _o_unused +#define _o_unused __attribute__((unused)) +#endif /* _o_unused */ #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -278,7 +286,7 @@ struct dhcpv6_retx { struct dhcpv6_header { uint8_t msg_type; uint8_t tr_id[3]; -} __attribute__((packed)); +} _o_packed; struct dhcpv6_ia_hdr { uint16_t type; diff --git a/src/ra.c b/src/ra.c index ffff0aa..dcc5fd6 100644 --- a/src/ra.c +++ b/src/ra.c @@ -71,7 +71,7 @@ struct { .lladdr = {ND_OPT_SOURCE_LINKADDR, 1, {0}}, }; -static void ra_send_rs(int signal __attribute__((unused))); +static void ra_send_rs(_o_unused int signal); int ra_init(const char *ifname, const struct in6_addr *ifid, unsigned int options, unsigned int holdoff_interval) @@ -189,7 +189,7 @@ failure: return -1; } -static void ra_send_rs(int signal __attribute__((unused))) +static void ra_send_rs(_o_unused int signal) { const struct sockaddr_in6 dest = {AF_INET6, 0, 0, ALL_IPV6_ROUTERS, if_index}; const struct icmpv6_opt llnull = {ND_OPT_SOURCE_LINKADDR, 1, {0}};